<?php
namespace Admin\Helper
{
    /**
     * Helper using to autovalidate user access
     * to admin section.
     */
     class  UserValidate extends \Api\Helper\AutoHelper
     {
        public  function    __autoUserValidate()
        {
            // Assign login to all action
            $this->login = new \Api\Model\Login($this->config);
            
            // Check logout parameter
            
            // Check does loaded module action is login
            if($this->ExcludedAction('login'))
            {
                if(\Api\Model\Login::IsValid())
                    \Api\Redirect::CreateRedirect('admin','index','index');
                else return;                              
            }else
            {
                if(!\Api\Model\Login::IsValid())
                {
                    \Api\Redirect::CreateRedirect('admin','index','login');
                }
                else
                { 
                    $param = $this->GetParameters();
                }
                
            }
                                          
        }
                
     }
}

?>